Copyright ã1995 by NeXT Computer, Inc.  All Rights Reserved.

NS_DEV_DOCFOR:objc_protocol:NXIgnoreMisspelledWords;,NXIgnoreMisspelledWords

Adopted By:	Text

Declared In:	appkit/NXSpellChecker.h

Protocol Description

This protocol permits an NXSpellChecker object to match the requests it receives with the documents they belong to.  The need arises because the list of ignored words is typically attached to a document, but that's not the way an NXSpellChecker receives its requests.

When the NXSpellChecker receives a request to check spelling, the request is made on behalf of an object that contains a text stream.  That object may represent a document's entire text, or just part of it.  Most applications permit the user to have several documents open at once.  The user may request several checks for the same document.  During a spelling check, the NXSpellChecker notes words that the user has accepted by clicking the Ignore button in the Spell Panel.  To make the ignored words feature more useful, the list developed during the current check must be consolidated with ignored words noted in previous checks.

The NXIgnoreMisspelledWords protocol specifies a method by which the NXSpellChecker can ask the text it is checking, ªWhat do you belong to?º  The method spellDocumentTag must return a tag that the NXSpellChecker can use to distinguish the documents being checked.  (See the discussion of ªMatching a List of Ignored Words With the Document It Belongs Toº in the description of the NXSpellChecker class.)  Once the NXSpellChecker has a way to distinguish the various documents, it can append new ignored words to the appropriate list.  The application can then ask the NXSpellChecker to initialize its private list of ignored words by copying them from a list stored with the document.

See also:  - setIgnoredWords: (NXSpellChecker)

Instance Methods

NS_DEV_DOCFOR:objc_method:[NXIgnoreMisspelledWords-spellDocumentTag];,spellDocumentTag

- (int)spellDocumentTag

Returns an arbitrary integer to identify the document (or other source) from which a text stream comes, and to distinguish between alternative documents that may be open at the same time.

The tags returned by this method are needed only during the current session.  The tag doesn't need to reflect the name of the document or even whether the document has a name.  The tag should survive unchanged if the user renames the file during the course of the session.  The tag returned by this method is used as an argument to the methods getIgnoredWordsForSpellDocument: and setIgnoredWords:forSpellDocument:.  For example, if myChecker is an NXSpellChecker instance and tStream is a text stream being checked:

[myChecker getIgnoredWordsForSpellDocument:[tStream spellDocumentTag]]

 A tag of 0 is illegal.